//bange_scene.hpp
//Copyright (C) 2010-2011 Oscar (.teri) Triano

//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.

//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.

//You should have received a copy of the GNU General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.

#ifndef _bange_scene_
#define _bange_scene_

#include <iostream>
#include <lua5.1/lua.hpp>
#include <chipmunk/chipmunk.h>
#include <bange_box.hpp>
#include <bange_layer.hpp>

using namespace std;

namespace bange{
	
	class scene: public bange::behavior{
		/*
		static int Begin(cpArbiter *, cpSpace *, void *);
		static int PreSolve(cpArbiter *, cpSpace *, void *);
		static void PostSolve(cpArbiter *, cpSpace *, void *);
		static void Separate(cpArbiter *, cpSpace *, void *);
		*/
		friend void bange::box::ManageEvent(sf::Event &);
		friend void bange::box::ProcessScenes();
		friend void bange::box::ProcessViews();
		private:
			float width;
			float height;
			bange::layer **layers;
		public:
			mutable int nlayers;
			mutable cpSpace *space;
			
			scene(float, float, int, lua_State *);
			bool NewIndex(lua_State *);
			bool Index(lua_State *);
			bange::layer **GetLayer(int);
			cpSpace *GetSpace(void);
			virtual void CleanVM(lua_State *);
			~scene();
			
			static void RegisterVM(lua_State *);
			
	};
	
}

//bange.
static int bangescene_NewScene(lua_State *);

//methods
static int bangescene_ResizeActiveHash(lua_State *);
static int bangescene_ResizeStaticHash(lua_State *);
static int bangescene_SetLayer(lua_State *);

#endif
